package com.lixiang.userinfo.util;


import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;



/**
 * 拦截器配置信息
 * @author 李湘
 * @date 2018-10-21
 */
@Configuration
@EnableWebMvc
@ComponentScan						  
public class MyWebAppConfig extends WebMvcConfigurerAdapter{
	
	public void addInterceptors(InterceptorRegistry registry){
		//配置跨域拦截器
		InterceptorRegistration access = registry.addInterceptor(new AccessHeaderInterceptor());
		access.addPathPatterns("/**");
		//配置登陆拦截器
		InterceptorRegistration login = registry.addInterceptor(new GlobalInterceptor()).excludePathPatterns("/register", "/img/*", "/account/login","/**/*.js");
	}

	
	
}
